package com.framework;

import java.util.UUID;

// 文件服务组件
class FileServiceComponent implements Component<FileInput, FileOutput> {

    @Override
    public String getType() {
        return "FileService";
    }

    @Override
    public ComponentOutput<FileOutput> execute(ComponentContext<FileInput> context) {
        FileInput input = context.getRequestData();

        // 处理文件逻辑
        FileOutput output = new FileOutput();
        output.setFileName(input.getFileName());
        output.setFileSize(input.getContent().length);
        output.setStoredPath("/uploads/" + UUID.randomUUID() + "-" + input.getFileName());

        return ComponentOutput.success(output);
    }
}